package io.renren.modules.mybog.dao;

import io.renren.modules.mybog.entity.CatePost;
import io.renren.modules.mybog.entity.CategoryEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 
 * 
 * @author 小🌤
 * @email 1578442339@qq.com
 * @date 2021-03-25 14:51:57
 */
@Mapper
public interface CategoryDao extends BaseMapper<CategoryEntity> {

    /*# 查询分类	 帖子的数量 */
    @Select("SELECT \n" +
            "      c.`tltle`,p.`create_time`,COUNT(p.`create_time`) AS counts\n" +
            "      FROM post p \n" +
            "    ,category c\n" +
            "      WHERE c.id=p.category_id  GROUP BY p.`category_id`  ")
    List<CatePost> getListCatePost();
}
